<?php

/**
* AdminMenuModule.class.php
*
* Concrete page module responsable for creating page footer
*
* @author     Blazej Zieba <b@zieba.info>
* @copyright  2007 konekto.com
* @version    CVS: $Id:$
*/

require_once("framework/PageModule.class.php");

// {{{ AdminMenuModule

class AdminMenuModule extends PageModule 
{
    // {{{ Class operations 

    // {{{ getContent

    /**
    * Function returns page content
    *
    */

    function getContent()
    {
        $options = &PEAR::getStaticProperty('CONFIG_INI','TEMPLATES'); 
        $global = &PEAR::getStaticProperty('CONFIG_INI','GLOBAL'); 
        $tpl = new HTML_Template_IT($options["templates_dir"]);
        $tpl->loadTemplatefile("menu.tpl.xhtml",true,true);

        if       ( $_REQUEST["cmd"] == "AdminGuideList" )
        {
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", "Logout") ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList&logout=1') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Lista tras") ) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');            
        }
        elseif  (  ( $_REQUEST["cmd"] == "AdminAddGuide" && !isset( $_REQUEST["id"] ) ) ||
                   ( $_REQUEST["cmd"] == "AdminAddGuide" && $_REQUEST["id"] == '' ))
        {


            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');


            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Dodaj trasę")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "AdminShowRoute" && is_numeric( $_REQUEST["id"] )  )
        {


            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');


            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  ( ( $_REQUEST["cmd"] == "AdminAddSlide" && isSet($_REQUEST["guide_id"] ) && !isset( $_REQUEST["id"] ) ) ||
                  ( $_REQUEST["cmd"] == "AdminAddSlide" && isSet( $_REQUEST["guide_id"] ) && $_REQUEST["id"] == '' ) )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Dodaj slajd")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "AdminAddSlide" && isSet( $_REQUEST["guide_id"] ) && is_numeric( $_REQUEST["id"] ) )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Edycja slajdu")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "AdminAddGuide" && is_numeric( $_REQUEST["id"] ) )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Edycja trasy")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "AdminRemoveSlide" && isset( $_REQUEST["Submit"] )  )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Usuń slajd")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }  
        elseif  (  $_REQUEST["cmd"] == "AdminRemoveSlide" && is_numeric( $_REQUEST["guide_id"] ) && is_numeric( $_REQUEST["id"] ) )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');


            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["guide_id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Edycja slajdu")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminAddSlide&guide_id='.$_REQUEST["guide_id"].'&id='.$_REQUEST["id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Usuń slajd")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }   
        elseif  (  $_REQUEST["cmd"] == "AdminRemoveGuide" && is_numeric( $_REQUEST["id"] ) )
        {

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Usuń trasę")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        elseif  (  $_REQUEST["cmd"] == "AdminRemoveGuide" && $_REQUEST["Submit"]  )
        {

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Usuń trasę")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }  
        elseif  (  $_REQUEST["cmd"] == "AuthForm" )
        {

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Login")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu'); 

        } 
        elseif  (  $_REQUEST["cmd"] == "AuthRegister" )
        {

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Login")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AuthForm') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Dodaj użytkownika")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }  
        elseif  (  $_REQUEST["cmd"] == "AdminSendCode"   )
        {

            /*
            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Lista tras")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminGuideList') ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');
            */

            $tpl->setCurrentBlock("link") ;    
            $tpl->setVariable("TITLE", _("Pokaż trasę")) ;
            $tpl->setVariable("LINK", $global['service_url'].'?cmd=AdminShowRoute&id='.$_REQUEST["id"]) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _("Wyślij kody")) ;
            $tpl->parseCurrentBlock() ;    
            $tpl->parse('menu');

        }
        return $tpl->get();
    }
    
    // }}}

    // }}}
}

// }}} 

?>
